package com.yangyu.mapper;

import com.yangyu.message.blog.BlogInfo;
import com.yangyu.message.blog.QueryBlogReq;
import com.yangyu.message.blog.SimpleBlogVo;
import com.yangyu.pojo.Blog;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface BlogMapper {

    int addBlog(@Param("blog") Blog blog);

    int deleteBlog(@Param("id") long id);

    int editBlog(@Param("blog") Blog blog);

    BlogInfo getBlogById(@Param("id") long id);

    List<BlogInfo> getBlogs(@Param("req") QueryBlogReq req);

    int countBlogs(@Param("req") QueryBlogReq req);

    int likeBlog(@Param("id") long id);

    int cancelBlog(@Param("id") long id);

    List<BlogInfo> getLikeBlogs(@Param("req") QueryBlogReq req);

    int countLikeBlogs(@Param("req") QueryBlogReq req);

    /**
     * 查询最热门的blog
     */
    List<SimpleBlogVo> getHotBlog();

    /**
     * 查询最新博客
     */
    List<SimpleBlogVo> getNewBlog();
}
